﻿using System;
using System.Collections.Generic;
using System.Text;

namespace T1_
{
    class Game
    {
        public string name;  //名称
        public string category;  //类别
        public double price;  //价格
        public int stock;  //数量
        public DateTime dateTime;  //时间


        /*
         */
         public void Yx()
        {
            Console.WriteLine("游戏名称:{0}",name);
            Console.WriteLine("游戏类别:{0}",category);
            Console.WriteLine("游戏价格:{0}",price);
            Console.WriteLine("游戏购买数量:{0}",stock);
            Console.WriteLine("游戏上架时间:{0}",dateTime);
         }


        /*
         */
        public bool Xy(int Xy) 
        {
            if (stock-Xy>=0)
            {
                stock -= Xy;
                Console.WriteLine("成功购买：{0},游戏类型：{1}，数量：{2},价格：{3}",name,category,Xy,(stock*Xy));
                return true;
            }
            else
            {
                Console.WriteLine("购买失败！");
                return false;
            }
        }

        /*
         */
        public void Sh(int sh) 
        {
            stock += sh;
            Console.WriteLine("成功入库{0}类型游戏：《{1}》{2}份",category,name,sh);
        }
    }
}
